package server.configuration;

import lombok.Data;

/**
 * 服务相关信息
 *
 * @author leonzhangxf
 */
@Data
public class Server {

    private Service service;

    public int getPort() {
        return getService().getConnector().getPort();
    }

    public String getAppBase() {
        return getService().getEngine().getHost().getAppBase();
    }

    public String getHostname() {
        return getService().getEngine().getHost().getName();
    }

    @Data
    public static class Service {
        private Connector connector;
        private Engine engine;
    }

    @Data
    public static class Engine {
        private Host host;
    }

    @Data
    public static class Connector {
        private Integer port;
    }

    @Data
    public static class Host {
        private String name;
        private String appBase;
    }
}
